<?php
/**
 * Description of OpenGraphWidget
 *
 * @author Samsung
 */
class OpenGraphWidget extends Widget {
    
    public $items=array();
    
    public function run(){
        Yii::beginProfile(get_class($this));
        
        $script = Yii::app()->clientScript;
        
        foreach($this->items as $type=>$content){
            if(is_array($content)){
                foreach($content as $value){
                    if(!empty($value))
                        $script->registerMetaTag($value, null, null, array('property'=>'og:'.strtolower($type)));
                }
            }else
                if(!empty($content))
                    $script->registerMetaTag($content, null, null, array('property'=>'og:'.strtolower($type)));
        }
        Yii::endProfile(get_class($this));
    }
}